<template>
	<view class="uiwu uiwu-flex-column flex flex-col justify-center items-center">
		<view class="uiwu-form">
			<view class="item uiwu-flex-align flex items-center">
				<image src="@/static/image/invite.png" mode="widthFix"></image>
				<input v-model="inviteCode" type="text" placeholder="请输入用户邀请码">
			</view>
		</view>
		<view class="uiwu-button flex justify-center items-center" @tap="tapLogin">确定</view>

		<view class="tiaog" @tap="tiaog">跳过</view>
		
	</view>
</template>

<script setup lang="ts">
import { bindMobile, uiwu } from '@/api/interface/interface';
import { onNavigationBarButtonTap } from '@dcloudio/uni-app';
import { ref } from "vue";
const inviteCode = ref<string>("");
/**
 * tapLogin 授权登录
 */
const tapLogin = async (): Promise<any> => {
	if (!inviteCode.value) return uiwu.toast('请填写邀请码')
	const result = await bindMobile({
		invite_code: inviteCode.value
	})
	if (!result) return
	uiwu.toast('绑定成功')
	uni.navigateTo({
		url: '/pages/index/index'
	})
}

const tiaog = () => {
	uni.navigateTo({
		url: '/pages/index/index'
	})
}

onNavigationBarButtonTap(() => {
	uni.navigateTo({
		url: '/pages/index/index'
	})
})
</script>

<style lang="scss">
page {
	background-color: #F6F6F6;
}

.uiwu {
	padding: 20rpx 0;
}

.uiwu-form {
	width: 100%;
	background: #FFFFFF;

	.item {
		width: 100%;
		height: 136rpx;
		padding: 0 24rpx;

		image {
			width: 44rpx;
			margin-right: 20rpx;
		}

		input {
			flex: 1;
			font-size: 28rpx;
		}

		text {
			font-size: 28rpx;
			font-weight: bold;
			color: #EF821E;
		}

		&:nth-child(1) {
			border-bottom: 1rpx solid #F1F1F1;
		}
	}
}

.uiwu-button {
	width: 670rpx;
	height: 80rpx;
	background: rgba(230, 0, 18, 1);
	border-radius: 40rpx;
	font-size: 32rpx;
	font-weight: bold;
	color: #FFFFFF;
	margin-top: 40rpx;

}

.tiaog {
	text-align: center;
	color: #999;
	margin-top: 40rpx;

}
</style>
